﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="System.Web.UI.Page" %>
<%@ Register Assembly="IZ.WebFileManager" Namespace="IZ.WebFileManager" TagPrefix="iz" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Import Namespace="IZ.WebFileManager" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title></title>
    <script runat="server">
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.izFileManager.Visible = OpenQuarters.WebQuarters.Core.User.Current.HasPermission(OpenQuarters.WebQuarters.Core.Permissions.CMSPage.Edit.SetValue(OpenQuarters.WebQuarters.Core.CMSPage.Current.PageId.ToString()));
            this.lblNotAuthorised.Visible = !OpenQuarters.WebQuarters.Core.User.Current.HasPermission(OpenQuarters.WebQuarters.Core.Permissions.CMSPage.Edit.SetValue(OpenQuarters.WebQuarters.Core.CMSPage.Current.PageId.ToString()));

            if (!string.IsNullOrEmpty(Request.QueryString["folder"]))
            {
                //this.izFileManager.Directory = this.izFileManager.Directory += Request.QueryString["folder"] + "/";
            }
        }
        
        protected void izFileManager_ExecuteCommand(object sender, ExecuteCommandEventArgs e)
        {
            switch (e.CommandName)
            {
                default:
                    throw new InvalidOperationException();
            }           
        }
        
        protected void izFileManager_ToolbarCommand(object sender, CommandEventArgs e)
        {
            switch (e.CommandName)
            {
                default:
                    throw new InvalidOperationException();
            }

        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="Div1" runat="server">
        <script type="text/javascript">
            function itemClicked(path) {
                parent.cmsFilePicker_SetPath('<%= Request.QueryString["field"] %>', path)
            }
        </script>
    </div>
    <div>
        <asp:Label ID="lblNotAuthorised" runat="server">You must be logged in to use the File Manager</asp:Label>
		<iz:FileManager ID="izFileManager" runat="server" Height="280px" Width="500px" OnExecuteCommand="izFileManager_ExecuteCommand"
			ClientOpenItemFunction="itemClicked" OnToolbarCommand="izFileManager_ToolbarCommand" ShowHiddenFilesAndFolders="false"
		 	ShowAddressBar="false">
			<RootDirectories>
				<iz:RootDirectory DirectoryPath="~/Areas/CMS/Content/UserFiles" Text="User Files" />
			</RootDirectories>
			<ToolbarOptions ShowRefreshButton="true" ShowViewButton="false" />
			<FileTypes>
				<iz:FileType Extensions="zip, rar, iso, gz, 7z" Name="Archive" SmallImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.small.compressed.gif"
					LargeImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.large.compressed.gif">
				</iz:FileType>
				<iz:FileType Extensions="doc, rtf, docx" Name="Microsoft Word Document" SmallImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.small.word.gif"
					LargeImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.large.word.gif">
				</iz:FileType>
				<iz:FileType Extensions="xls, csv, xlsx" Name="Microsoft Excel Worksheet" SmallImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.small.excel.gif"
					LargeImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.large.excel.gif">
				</iz:FileType>
				<iz:FileType Extensions="ppt, pps, pptx" Name="Microsoft PowerPoint Presentation" SmallImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.small.PowerPoint.gif"
					LargeImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.large.PowerPoint.gif">
				</iz:FileType>
				<iz:FileType Extensions="gif, jpg, png, bmp, jpeg" Name="Image" SmallImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.small.image.gif"
					LargeImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.large.image.gif">
				</iz:FileType>
				<iz:FileType SmallImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.small.media.gif" Name="Windows Media File" Extensions="mp3,wma,vmv,avi,divx,mpeg,mpg,mp4,mkv,mov"
					LargeImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.large.media.gif">
				</iz:FileType>
				<iz:FileType Extensions="txt" Name="Text Document">
				</iz:FileType>
				<iz:FileType Extensions="xml, xsl, xsd" Name="XML Document" LargeImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.large.xml.gif"
					SmallImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.small.xml.gif">
				</iz:FileType>
				<iz:FileType Extensions="css" Name="Cascading Style Sheet" LargeImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.large.styleSheet.gif"
					SmallImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.small.styleSheet.gif">
				</iz:FileType>
				<iz:FileType Extensions="js, vbs" Name="Script File" LargeImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.large.script.gif"
					SmallImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.small.script.gif">
				</iz:FileType>
				<iz:FileType Extensions="htm, html" Name="HTML Document" LargeImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.large.html.gif"
					SmallImageUrl="/CMS/File/Resource?Assembly=OpenQuarters.WebQuarters.Core.Web&Filename=Areas.CMS.Content.Images.IZWebFileManager.small.html.gif">
				</iz:FileType>
			</FileTypes>
		</iz:FileManager>
    </div>
    </form>
</body>
</html>
